package com.wly.control.common
{
	import com.wly.ui.common.IBaseUI;

	public class BaseControl
	{
		protected var _ui:IBaseUI;
		
		public function BaseControl()
		{
		}
		
		public function attachUI(ui:IBaseUI):void
		{
			if(_ui)
			{
				_ui.deattachUIControl();
				_ui = null;
			}
			
			_ui = ui;
			if(_ui)
			{
				onUIAttach();
				updateUI();
			}
		}
		
		public function deattachUI():void
		{
			if(_ui)
			{
				onUIDeattach();
				_ui = null;
			}
		}
		
		protected function onUIAttach():void
		{
		}
		
		protected function onUIDeattach():void
		{
			
		}
		
		public function updateUI():void
		{
		}
	}
}